using UnityEngine;

namespace EpicToonFX
{
    // [Assembly-CSharp.dll].EpicToonFX.ETFXLoopScript
    public class ETFXLoopScript : MonoBehaviour
    {
        
        #region EpicToonFX.ETFXLoopScript.<EffectLoop>d__6
        // [Assembly-CSharp.dll].EpicToonFX.ETFXLoopScript.<EffectLoop>d__6
        private sealed class _EffectLoop_d__6 : IEnumerator<object>, IEnumerator, IDisposable
        {
            // Fields
            private int __1__state;
            private object __2__current;
            public EpicToonFX.ETFXLoopScript __4__this;
            private UnityEngine.GameObject _effectPlayer_5__2;
            
            // Properties
            private object System.Collections.Generic.IEnumerator<System.Object>.Current { get; }
            private object System.Collections.IEnumerator.Current { get; }
            
            // Methods
            public _EffectLoop_d__6(int __1__state)
            {
                this.__1__state = __1__state;
            }
            private void System.IDisposable.Dispose()
            {
            
            }
            private bool MoveNext()
            {
                EpicToonFX.ETFXLoopScript val_15;
                UnityEngine.Object val_16;
                val_15 = this.__4__this;
                val_16 = 27351912;
                if(this.__1__state != 1)
                {
                        if(this.__1__state != 0)
                {
                        return false;
                }
                
                    this.__1__state = 0;
                    UnityEngine.Vector3 val_2 = val_15.transform.position;
                    UnityEngine.Quaternion val_4 = val_15.transform.rotation;
                    this._effectPlayer_5__2 = UnityEngine.Object.Instantiate<System.Object>(original:  this.__4__this.chosenEffect, position:  new UnityEngine.Vector3() {x = val_2.x, y = val_2.y, z = val_2.z}, rotation:  new UnityEngine.Quaternion() {x = val_4.x, y = val_4.y, z = val_4.z, w = val_4.w});
                    bool val_7 = UnityEngine.Object.op_Implicit(exists:  this._effectPlayer_5__2.GetComponent<System.Object>());
                    this.__4__this.spawnWithoutLight = val_7;
                    if(val_7 != false)
                {
                        this._effectPlayer_5__2.GetComponent<System.Object>().enabled = false;
                }
                
                    val_16 = this._effectPlayer_5__2.GetComponent<System.Object>();
                    bool val_11 = UnityEngine.Object.op_Implicit(exists:  val_16);
                    this.__4__this.spawnWithoutSound = val_11;
                    if(val_11 != false)
                {
                        this._effectPlayer_5__2.GetComponent<System.Object>().enabled = false;
                }
                
                    UnityEngine.WaitForSeconds val_14 = 536895821;
                    val_15 = val_14;
                    val_14 = new UnityEngine.WaitForSeconds(seconds:  this.__4__this.loopTimeLimit);
                    this.__2__current = val_15;
                    this.__1__state = 1;
                    return false;
                }
                
                this.__1__state = 0;
                UnityEngine.Object.Destroy(obj:  this._effectPlayer_5__2);
                val_15.PlayEffect();
                return false;
            }
            private object System.Collections.Generic.IEnumerator<System.Object>.get_Current()
            {
                return (object)this.__2__current;
            }
            private void System.Collections.IEnumerator.Reset()
            {
                27351792 = new System.NotSupportedException();
                throw 27351792;
            }
            private object System.Collections.IEnumerator.get_Current()
            {
                return (object)this.__2__current;
            }
        
        }
        
        #endregion
        
        // Fields
        public UnityEngine.GameObject chosenEffect;
        public float loopTimeLimit;
        public bool spawnWithoutLight;
        public bool spawnWithoutSound;
        
        // Methods
        private void Start()
        {
            this.PlayEffect();
        }
        public void PlayEffect()
        {
            UnityEngine.Coroutine val_1 = this.StartCoroutine(methodName:  -1610607985);
        }
        private System.Collections.IEnumerator EffectLoop()
        {
            object val_1 = 536898429;
            val_1 = new System.Object();
            mem[536898445] = 0;
            mem[536898461] = this;
            return (System.Collections.IEnumerator)val_1;
        }
        public ETFXLoopScript()
        {
            this.loopTimeLimit = 2f;
            this.spawnWithoutLight = true;
            this.spawnWithoutSound = true;
        }
    
    }

}
